import { notFound } from "next/navigation"; import type { ReactNode } from "react"; import { api } from "@/lib/api"; /** * Existence gate: a 404 from the API becomes a real HTTP 404 here, before the segment's loading.tsx * streams a 200 shell. The page re-fetches the same URL (deduplicated by the fetch cache). */ export default async function OperatorLayout({ children, params }: { children: ReactNode; params: Promise<{ slug: string }> }) { const { slug } = await params; const r = await api.operator(slug); if (!r.ok && r.status === 404) notFound(); return <>{children}; }